//
//  ByCellUserMyRealName.m
//  jinpuyiyuan_ios
//
//  Created by pro on 2017/12/14.
//  Copyright © 2017年 mc. All rights reserved.
//

#import "ByCellUserMyRealName.h"

@implementation ByCellUserMyRealName

+ (instancetype)cellWithTableView:(UITableView*)tableView{
    
    static NSString *cellIdentifier = @"ByCellUserMyRealName";
    ByCellUserMyRealName *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[self alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    return cell;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSeparatorStyleNone;
    }
    return self;
}

- (void)setTitle:(NSString *)title{
    _title = title;
    for (UIView *subview in self.subviews) {
        [subview removeFromSuperview];
    }
    UILabel *titleLabel = [[UILabel alloc] init];
    [self addSubview:titleLabel];
    CGFloat width = [@"身份证号：" getSizeOfString:14].width + 10;
    [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(10));
        make.top.equalTo(@(10));
        make.size.mas_equalTo(CGSizeMake(width, 20));
    }];
    titleLabel.font = FONT(14);
    titleLabel.text = _title;
    
    UIView *bgView = [[UIView alloc] init];
    [self addSubview:bgView];
    [bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(titleLabel.mas_right);
        make.top.equalTo(@(0));
        make.right.equalTo(@(-30));
        make.bottom.equalTo(@(0));
    }];
    bgView.backgroundColor = [UIColor colorWithWhite:0.90 alpha:1];
    
    UITextField *tf = [[UITextField alloc] init];
    [bgView addSubview:tf];
    [tf mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(10));
        make.right.equalTo(@(-10));
        make.top.equalTo(@(10));
        make.bottom.equalTo(@(-10));
    }];
    tf.font = FONT(14);
    
}

@end
